package org.pork.service;

import java.util.List;

import javax.inject.Inject;

import org.apache.log4j.Logger;
import org.pork.criteria.TeamCriteria;
import org.pork.domain.TeamBbsVO;
import org.pork.domain.TeamReplyVO;
import org.pork.mapper.TeamBbsMapper;
import org.pork.mapper.TeamReplyMapper;
import org.springframework.stereotype.Service;

@Service
public class TeamBbsService {

	
	@Inject
	TeamBbsMapper mapper;
	
	@Inject
	TeamReplyMapper rmapper;
	
	Logger logger = Logger.getLogger("TeamBbsService");
	
	
	public void regist(TeamBbsVO vo) throws Exception {
		
		logger.info("TeamBbsService regist.............................");
		
		mapper.create(vo);
	
	}

	public TeamBbsVO view(TeamBbsVO vo) throws Exception {
		logger.info("TeamBbsService view.............................");
		
		return mapper.read(vo);
	}

	public void remove(Integer seqno) throws Exception {
		logger.info("TeamBbsService remove.............................");
		
		mapper.delete(seqno);
		
	}

	public void modify(TeamBbsVO vo) throws Exception {
		
		logger.info("TeamBbsService modify.............................");		
		
		mapper.update(vo);
		
	}
	
	public List<TeamBbsVO> list(TeamCriteria cri) throws Exception {

		logger.info("TeamBbsService List.............................");		
		
		return mapper.list(cri);
		
	
		
	}
	
	public List<TeamBbsVO> noticeList(TeamCriteria cri) throws Exception {

		logger.info("TeamBbsService List.............................");		
		
		return mapper.noticeList(cri);
		
	
		
	}
	
	///////리플//////////
	
	public void replyRegist(TeamReplyVO vo) throws Exception {
		
		rmapper.createReply(vo);
		
	}
	
	public void replyModify(TeamReplyVO vo) throws Exception {
		
		
		rmapper.updateReply(vo);
		
	}
	
	public void replyRemove(Integer replyno) throws Exception {
		
		rmapper.deleteReply(replyno);
		
	}
	
	public List<TeamReplyVO> replyList(Integer bbsno) throws Exception {
		
		return rmapper.replyList(bbsno);
		
	}
	
}
